<!DOCTYPE>
<body id=body>
<script src="../../../resources/js-test.js"></script>

<label id="label1">Label: <input type="date" id="date1"></label>
<script>
debug('Check if clicking a label focuses on a date input in it.');
// Force layout because we can't focus on elements without LayoutBox.
document.body.offsetLeft; 
shouldBeEqualToString('document.activeElement.id', 'body');
debug('Clicking a label.');
var clickEvent = document.createEvent('MouseEvent');
clickEvent.initEvent('click', true, true);
document.getElementById('label1').dispatchEvent(clickEvent);
shouldBeEqualToString('document.activeElement.id', 'date1');
</script>
</body>
